"""
df的列按某一行的值进行排序
"""
import pandas as pd

df1 = pd.DataFrame(
    [{"r1": 1, "r2": 1, "symbol": 2},
     {"r1": 2, "r2": 2, "symbol": 3},
     {"r1": 1, "r2": 2, "symbol": 4},
     {"r1": 1, "r2": 3, "symbol": 2}
     ]
)

l1 = df1.iloc[-1]
s_l1 = l1.sort_values(ascending=False)
df2 = df1[list(s_l1.keys())]